package org.gjy.m8.collection;

import com.google.common.collect.Lists;
import org.junit.Test;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

/**
 * @author gjy
 * @version 1.0
 * @since 2024-01-19 14:06:24
 */
public class ListTest {

    @Test
    public void test3() {
        long amount = 14103214;
        System.out.println(amount / 100 + "." + amount % 100);
    }

    @Test
    public void testListPartition2() {
        List<Integer> collect = IntStream.rangeClosed(1, 300).boxed().collect(Collectors.toList());
        List<List<Integer>> partition = Lists.partition(collect, 3000);
        for (List<Integer> integers : partition) {
            System.out.println(integers);
            System.out.println(integers.size());
        }
    }

    @Test
    public void testListPartition1() {
        List<Integer> collect = IntStream.rangeClosed(1, 7000).boxed().collect(Collectors.toList());
        List<List<Integer>> partition = Lists.partition(collect, 3000);
        for (List<Integer> integers : partition) {
            System.out.println(integers);
            System.out.println(integers.size());
        }
    }

    @Test
    public void test1() {
        ArrayList<Object> list = Lists.newArrayList(1, 2, 3);
        ArrayList<Object> strings = Lists.newArrayList("a", "b", "c");

        System.out.println(list.addAll(strings));
        System.out.println("list = " + list);

        System.out.println(strings.addAll(list));
        System.out.println("strings = " + strings);
    }
}
